const proxy_api = "/dev-api"; // 本地/dev-api 线上映射  /emergencys/prod-api  普通war包后端 /prod-api
const env_value = "development"; // 本地 development 线上 production  映射打包 命令 npm run build:stage
const http = (function (_this) {
  let proxy = "";
  proxy = proxy_api;
  console.log(location.origin + proxy);
  const http = axios.create({
    timeout: 300000,
    baseURL: location.origin + proxy,
  });
  http.interceptors.request.use(
    function (suc) {
      return suc;
    },
    function (err) {
      return err;
    }
  );
  http.interceptors.response.use(
    (response) => {
      if (response.data?.code !== 200) {
        //_this.$message.error(response.data?.msg);
        return Promise.reject(response.data);
      }
      return Promise.resolve(response.data);
    },
    (error) => {
      const { response } = error;
      switch (response.status) {
        case 400:
         // _this.$message.error("错误请求");
          break;
        case 401:
         // _this.$message.error("未授权，请重新登录");
          break;
        case 403:
         // _this.$message.error("拒绝访问");
          break;
        case 404:
          // _this.$message.error(response.config.url + "请求错误，未找到该资源");
          console.log(response.config.url + "请求错误，未找到该资源");
          break;
        case 408:
         // _this.$message.error("请求超时");
          break;
        case 500:
          // _this.$message.error(response.config.url + response.data?.message);
          // console.log(response.config.url + "请求错误，未找到该资源");
          break;
        case 501:
         // _this.$message.error("网络未实现");
          break;
        case 502:
         // _this.$message.error("网络错误");
          break;
        case 503:
         // _this.$message.error("服务不可用");
          break;
        case 504:
          //_this.$message.error("网络超时");
          break;
        case 505:
          //_this.$message.error("http版本不支持该请求");
          break;
        default:
          //_this.$message.error(`连接错误${err.response.status}`);
      }
      return Promise.reject(error);
    }
  );
  return http;
})(Vue.prototype);
String.prototype.splitStrFn = function (number) {
  if (this.length > number) {
    return this.slice(0, number) + "...";
  } else {
    return this;
  }
};
String.prototype.HTMLDecode = function () {
  var temp = document.createElement("div");
  temp.innerHTML = this;
  var output = temp.innerText || temp.textContent;
  temp = null;
  return output;
};
Vue.prototype.numFormat = function (num) {
  num = String(num);
  var c =
    num.toString().indexOf(".") !== -1
      ? num.toLocaleString()
      : num.toString().replace(/(\d)(?=(?:\d{3})+$)/g, "$1,");
  return c;
};
Vue.prototype.numberWith = function (number) {
  let str = String(number).split(".");
  let one = this.numFormat(str[0]);
  let two = str[1] ? "." + str[1] : "";
  return one + two;
};
window.formatRichText = function (selector, number) {
  let arr1 = document.querySelectorAll(selector);
  let nodes = Array.prototype.slice.call(arr1);
  nodes.map((res) => {
    let text = res.innerText || res.textContent;
    if (number) {
      res.innerHTML = text.splitStrFn(number);
    }
  });
};
window.debounce = function (fn, delay = 500) {
  let timer;
  return function () {
    if (timer) {
      clearTimeout(timer);
    }
    const args = arguments;
    if (!fn) return;
    timer = setTimeout(() => {
      fn.apply(this, args); // 改变this指向为调用debounce所指的对象
    }, delay);
  };
};
Vue.prototype.Request = http;
Vue.prototype.VUE_APP_BIG_SCREEN =
  env_value === "development" ? "" : "/emergencys"; // 大屏映射前缀 根据不同要求可修改 /emergencys war ""
Vue.prototype.iframeUrl =
  Vue.prototype.VUE_APP_BIG_SCREEN + "/bigHtml/gis/test-xy/index.html";
Vue.prototype.arUrl =
  Vue.prototype.VUE_APP_BIG_SCREEN + "/bigHtml/ar/ARWebControl_Demo.html";
// Vue.prototype.vrUrl =
//   Vue.prototype.VUE_APP_BIG_SCREEN + "/bigHtml/number_vr/demo.html"; 
  Vue.prototype.vrUrl = "http://10.65.175.16:8082/cimportal/#/meshMap?type=Urbanbrain";
Vue.prototype.gisIconUrl =
  Vue.prototype.VUE_APP_BIG_SCREEN + "/bigHtml/gis/test-xy/img/"; // 备用路径
Vue.prototype.getDicts = function (params) {
  // function getToken(name) {
  //   //获取指定名称的cookie的值
  //   var str = document.cookie.split("; ");
  //   for (var i = 0; i < str.length; i++) {
  //     var temp = str[i].split("=");
  //     if (temp[0] == name) return temp[1];
  //   }
  // }
  return Vue.prototype.Request({
    url: "/common/getBigScreenDict",
    method: "get",
    params: params,
    // headers: {
    //   Authorization: "Bearer " + getToken("Admin-Token"),
    // },
  });
};
Vue.prototype.fontSize = 16;
Vue.prototype.nameFontSize = 14;
Vue.prototype.fontFamily = "Barlow";
Vue.prototype.xAxisFontFamily = "思源黑体";
Vue.prototype.echartsMouse = function (selector, myChart, attr = "index") {
  let cls = document.querySelectorAll(selector);
  let arr = Array.prototype.slice.call(cls);
  arr.map((res) => {
    res.onmouseenter = function () {
      myChart.dispatchAction({
        type: "highlight",
        seriesIndex: 0,
        dataIndex: res.getAttribute(attr),
      });
    };
    res.onmouseleave = function () {
      myChart.dispatchAction({
        type: "downplay",
        seriesIndex: 0,
        dataIndex: res.getAttribute(attr),
      });
    };
  });
};
Vue.prototype.getEchartsConfig = function (name, obj1) {
  let extra = Object.assign(
    {
      unit: "",
      trigger: "item",
      formatterLength: 4, // 坐标轴的长度换行
      formatter: function (value) {
        // 必须传函数
        var ret = "";
        var maxLength = this.formatterLength;
        var rowNum = Math.ceil(value.length / maxLength);
        if (rowNum > 1) {
          for (var i = 0; i < rowNum; i++) {
            var temp = "";
            var start = i * maxLength;
            var end = start + maxLength;
            temp = value.substring(start, end) + "\n";
            ret += temp;
          }
          return ret;
        } else {
          return value;
        }
      },
      formatterOpen: false, // 是否开启自定义内容
    },
    obj1
  );
  let obj = function (extra1) {
    let axisLabel = {
      // padding: [10, 10, 10, 10],
      // interval: 0, // 坐标轴刻度标签的显示间隔
      // rotate: 0, // 倾向角度
      textStyle: {
        fontSize: 16,
        fontWeight: 500,
        fontFamily: "Barlow",
        color: "rgba(255, 255, 255, 0.65)",
      },
    };
    if (extra1.formatterOpen) {
      axisLabel.formatter = extra1.formatter.bind(extra1); // 自定义样式
    }
    return {
      tooltip: {
        trigger: extra1.trigger,
        // trigger: "axis", // 触发类型  'axis' 图形触发：散点图，饼图等无类目轴的图表中使用； item 'axis'坐标轴触发；'none'：什么都不触发。
        axisPointer: {
          // 坐标轴指示器配置项。
          type: "shadow", // 'line' 直线指示器  'shadow' 阴影指示器  'none' 无指示器  'cross' 十字准星指示器。
          axis: "auto", // 指示器的坐标轴。
          snap: true, // 坐标轴指示器是否自动吸附到点上
        },
        // 鼠标悬停 样式标准
        formatter: `<div style='font-size:20px;'>{a}</div> <br/><span style='font-size:16px'>{b}</span>: <span class='dian_ti_blue_gradual_white' style='font-size:20px'>{c}${extra1.unit}</span> <span class='dian_ti_blue_gradual_white'>({d}%)</span>`,
        textStyle: {
          fontSize: this.fontSize, // 字体大小
        },
        // trigger: "item",
        extraCssText:
          "background: linear-gradient(180deg, rgba(255,255,255,0.20) 7%, rgba(255,255,255,0.10) 96%);border-image: linear-gradient(180deg, rgba(255,255,255,0.20) 7%, rgba(255,255,255,0.00) 97%)",
        // color: "black",
        borderWidth: "1", //边框宽度设置1
        // border: "linear-gradient(180deg, rgba(255,255,255,0.20) 7%, rgba(255,255,255,0.00) 97%)", //设置边框颜色
        textStyle: {
          color: "#ffffff", //设置文字颜色
        },
        // position: ['50%', '40%']
      },
      xAxis: {
        // axisTick: {
        //   show: true,
        // },
        // axisLine: {
        //   //坐标轴轴线相关设置。数学上的x轴
        //   show: true,
        //   lineStyle: {
        //     color: "rgba(255, 255, 255, 0.65)",
        //     // width: 1,
        //   },
        // },
        splitLine: {
          //坐标轴轴线相关设置。数学上的x轴
          show: true,
          lineStyle: {
            color: "rgba(255, 255, 255, 0.12)",
          },
        },
        axisLabel: axisLabel,
        nameTextStyle: {
          color: "rgba(255, 255, 255, 0.65)",
          padding: [0, 20, 0, 0],
          align: "right",
          fontSize: 16,
          fontFamily: "Barlow-Medium",
        },
        axisTick: {
          show: false,
        },
      },
      lineBackground: {
        showBackground: true,
        backgroundStyle: {
          color: "rgba(0, 255, 203, 0.2)",
          // borderRadius: [28, 28, 28, 28], // 重点
        },
        itemStyle: {
          normal: {
            label: {
              show: true, //开启显示
              position: "top", //在上方显示
              textStyle: {
                //数值样式
                color: "#FFFFFF",
                fontSize: 16,
                // fontWeight: 400,
              },
              formatter: "{c}次",
            },
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
              {
                offset: 0,
                color: "#3CA5F0",
              },
              {
                offset: 1,
                color: "#3CF0E1",
              },
            ]),
          },
        },
      },
    };
  };
  return obj.call(this, extra)[name];
};
Vue.prototype.calculateBg = function (data) {
  let max,
    avg,
    len = 5;
  if (data) {
    let le = String(Math.max(...data));
    avg = Math.pow(10, le.length - 1); //刻度
    max = Math.max(...data) + avg; // 最大
    len = data.length || 5; // 初始长度
    let arr = new Array(len).fill(max || 700);
    return {
      avg,
      max,
      len,
      arr,
      obj: {
        type: "bar",
        data: arr, // 初始化柱子的数据
        barWidth: 24, // 阴影的宽度
        barGap: -0.75, // 柱子的偏移量
        itemStyle: {
          normal: {
            // barBorderRadius: 20,
            color: "rgba(51, 252, 241, 0.1)",
          },
        },
        z: 1,
        tooltip: {
          show: false,
        },
      },
      yAxis: {
        interval: avg || 200,
        scale: true,
        max: max,
        min: 0,
      },
    };
  } else {
    return {};
  }
};
Vue.prototype.debounce = function (fn, delay = 500) {
  let timer;
  return function () {
    if (timer) {
      clearTimeout(timer);
    }
    const args = arguments;
    timer = setTimeout(() => {
      fn.apply(this, args); // 改变this指向为调用debounce所指的对象
    }, delay);
  };
};
Vue.prototype.closeEl = function (status, fn) {
  this.$el.style.display = status;
  this.display = status;
  if (typeof fn === "function") {
    this.$nextTick((_) => {
      fn(this);
    });
  }
};
Vue.mixin({
  // 全局混入 所有组件都可以使用
  // 地图交互的逻辑
  data: function () {
    return {
      iframeShow: true, // 控制地图显示
      iframeDom: null, // 地图对象
      gisStatus: "2",
      gisMap: new Map(),
      pathApi:proxy_api === '/dev-api'?'/api2':'',
      vrDom: null,
      arDom: null, // ar 对象
    };
  },
  async mounted() {
    setTimeout(() => {
      let dom = document.getElementById("mainIframe");
      if (dom) {
        let win = dom.contentWindow;
        this.iframeDom = win;
      }
      let arDom = document.getElementById("arDom");
      if (arDom) {
        let win = arDom.contentWindow;
        this.arDom = win;
      }
      let vrDom = document.getElementById("vrDom");
      if (vrDom) {
        let win = vrDom.contentWindow;
        this.vrDom = win;
      }
      // console.log(this.vrDom, this.vrDom.cloudRender, "vr");
    }, 1000);
  },
  methods: {
 handleScreenAuto() {
      const designDraftWidth = 4992; //设计稿的宽度
      const designDraftHeight = 2184; //设计稿的高度
      //根据屏幕的变化适配的比例
      const scale =
        document.documentElement.clientWidth /
          document.documentElement.clientHeight <
          designDraftWidth / designDraftHeight
          ? document.documentElement.clientWidth / designDraftWidth
          : document.documentElement.clientHeight / designDraftHeight;
      //缩放比例
      document.querySelector(
        ".screen"
      ).style.transform = `scale(${scale}) translate(-50%)`;
    },
    weiduChange(number) {
      this.iframeShow = true;
      this.gisStatus = String(number);
      if (this.iframeDom) {
        if (this.gisStatus === "2") {
          this.iframeDom.changeSceneMode(number);
        }
      } else {
        //this.$message.warning("地图加载中");
      }

      if (this.vrDom) {
        if (this.gisStatus === "3") {
          this.vrDom.initVr();
        }
      } else {
        //this.$message.warning("地图加载中");
      }
    },
    async initAr() {
      await this.arDom.init();
      await this.arDom.setup();
    },
    async CloseAr() {
      if (this.arDom) {
        this.arDom.controlWebStatus(2);
      }
    },
    async maplist(type) {
      let res = await this.Request({
        url: "/map/TbMapPoint/getMaplist/" + type,
        method: "get",
      });
      return res.data;
    },
    showAr() {
      this.gisStatus = "ar";
      this.iframeShow = false;
      if (this.arDom) {
        this.initAr();
      }
    },
    iconClick(iconItem) {
      // 图例点击全局方法
      // console.log(iconItem, "ss");
      if (this.gisStatus === "2") {
        this.gisMap.set(iconItem.name, iconItem.icon);
        // console.log(this.gisMap, "ss");
        if (this.iframeDom) {
          this.iframeDom.shiliOnload("polygon");
        } else {
          //this.$message.warning("地图加载中");
        }
      }
    },
    totalClick() {
      let self = this;
      // 重写全局混入方法 图例点击全局方法
      if (this.gisStatus === "2") {
        if (this.iframeDom) {
          // this.iframeDom.DivIcon();
          let requestFn = function () {
            return new Promise((resolve, reject) => {
              setTimeout(() => {
                let arr = [
                  {
                    name: "分宜区",
                    value: 50,
                    dialogFn: async function (item, index) {
                      return `<div v-show="dialogShow" style="height:600px" class="tanchuang29 vue_key${index} ">
                        <div class="tou3">
                            <span>{{item.name}}</span>
                            <img @click="dialogShow = false" src="../../dialog/images/gb.png">
                        </div>
                        <div class="neirong1">
                            <div class="rysdfx" style="height:400px;margin-top:0px">
                                <div class="rysd_biao">人群时段分布</div>
                                <div class="rysd_nr" style="margin-top:0px;">
                                  <div class="header_xiao3" style="width: 1120px;display: flex;">
                                        <div
                                            style="display: flex;flex:1;height: 50px;justify-content: end;align-items: center;position: relative;top: 43px;right: 6px;">
                                            <div style="display: flex;align-items: center;margin-right: 32px;">
                                                <img src="./img/lan.png" alt="" style="margin-right: 10px;">
                                                <span
                                                    style="font-family: SourceHanSansCN-Regular;padding-bottom: 2px;font-size: 16px;font-weight: normal;color: #FFFFFF;">人群密度</span>
                                            </div>
                                            <div style="display: flex;align-items: center;">
                                                <img src="./img/juhuang.png" alt="" style="margin-right: 10px;">
                                                <span
                                                    style="font-family: SourceHanSansCN-Regular;font-size: 16px;padding-bottom: 2px;font-weight: normal;color: #FFFFFF;">聚集人数</span>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="qstu" style="width:100%;height:100%" >
                                        <liuru-box ref="liuruBox" :open-legend="false"></liuru-box>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>`;
                    },
                    dialogLoad: function (item, index) {
                      console.log(this.gis, "当前定位");
                      let classIndex2 = self.iframeDom.document.querySelector(
                        ".vue_key" + index
                      );
                      new Vue({
                        el: classIndex2,
                        data() {
                          return {
                            dialogShow: true,
                            item: item,
                            content: {
                              name: "暂无",
                              maintenanceCompany: "暂无",
                              maintenancePersonnel: "暂无",
                              maintenancePersonnelPhone: "暂无",
                              maintenanceDueDate: "暂无",
                            },
                          };
                        },
                        methods: {
                          tendency() {
                            console.log(this, "ssffw");
                            this.$refs.liuruBox.print(
                              [
                                "0-2时",
                                "4-6时",
                                "8-12时",
                                "14-16时",
                                "18-20时",
                              ],
                              [20, 20, 15, 12, 33, 44],
                              [120, 200, 150, 12, 33, 44]
                            );
                          },
                        },
                        components: {
                          // liuruBox,
                        },
                        mounted() {
                          // this.$nextTick((_) => {
                          //   this.tendency();
                          // });
                        },
                      });
                    },
                    response: {
                      code: 200,
                      data: [],
                    },
                  },
                  {
                    name: "新余市",
                    value: 160,
                    dialogFn: async function () {
                      return `<div style="width:200px;background:rgba(255,255,0,0.2)">我是一个div，你可以对我添加css样式和内容</div>`;
                    },
                    dialogLoad: function () {
                      console.log(this.gis, "当前定位");
                    },
                    response: {
                      code: 200,
                      data: [],
                    },
                  },
                  {
                    name: "渝水区",
                    value: 240,
                    dialogFn: async function () {
                      return `<div style="width:200px;background:rgba(255,255,0,0.2)">我是一个div，你可以对我添加css样式和内容</div>`;
                    },
                    dialogLoad: function () {
                      console.log(this.gis, "当前定位");
                    },
                    response: {
                      code: 200,
                      data: [],
                    },
                  },
                  {
                    name: "高新区",
                    value: 50,
                    dialogFn: async function () {
                      return `<div style="width:200px;background:rgba(255,255,0,0.2)">我是一个div，你可以对我添加css样式和内容</div>`;
                    },
                    dialogLoad: function () {
                      console.log(this.gis, "当前定位");
                    },
                    response: {
                      code: 200,
                      data: [],
                    },
                  },
                ];
                arr.map((res) => {
                  let lng = 114.66823444 + Math.random() * 0.5;
                  let lat = 27.5999376 + Math.random() * 0.5;
                  res.lng = lng;
                  res.lat = lat;
                  res.height = 100;
                });
                resolve({
                  code: 200,
                  data: arr,
                });
              }, 1500);
            });
          };
          requestFn().then((res) => {
            console.log(res, "ff");
            self.iframeDom.DivIcon(res.data);
          });
        }
      }
    },
  },
});
Vue.directive("width", {
  bind: function (el, bind) {
    el.style.width = "0px";
    el.style.transition = "width 2s";
    setTimeout(() => {
      el.style.width = bind.value;
    }, 10);
  },
  update: function (el, bind) {
    // el.style.width = "0px";
    el.style.transition = "width 2s";
    setTimeout(() => {
      el.style.width = bind.value;
    }, 10);
  },
  // componentUpdated: function (el, bind) {
  //   el.style.width = "0px";
  //   el.style.transition = "width 2s";
  //   setTimeout(() => {
  //     el.style.width = bind.value;
  //   }, 10);
  // },
});
Vue.directive("load", {
  bind: function (el, bind) {
    if ([true, false].includes(bind.value)) {
      if (bind.value === true) {
        el.style.visibility = "visible";
      }
      if (bind.value === false) {
        el.style.visibility = "hidden";
      }
    } else {
      console.warn("v-load只支持true false 布尔值");
    }
  },
  componentUpdated: function (el, bind) {
    if ([true, false].includes(bind.value)) {
      if (bind.value === true) {
        el.style.visibility = "visible";
      }
      if (bind.value === false) {
        el.style.visibility = "hidden";
      }
    } else {
      console.warn("v-load只支持true false 布尔值");
    }
  },
});
Vue.directive("animate", {
  // bind: function (el, bind) {
  //   // el.style.width = "0px";
  //   // el.style.transition = "width 2s";
  //   // let arr = bind.value.split(" ");

  //   // setTimeout(() => {
  //   //   el.style.width = bind.value;
  //   // }, 10);
  // },
  update: function (el, bind) {
    let arr = bind.value.split(" ");
    let list = Array.prototype.slice.call(el.classList);
    el.classList = arr.join(" ");
  },
  // componentUpdated: function (el, bind) {
  //   el.style.width = "0px";
  //   el.style.transition = "width 2s";
  //   setTimeout(() => {
  //     el.style.width = bind.value;
  //   }, 10);
  // },
});
Vue.prototype.newPieTooltip = {
  trigger: "item",
  // 鼠标悬停 样式标准
  formatter: ` <div style='min-width:150px'><span style='font-size:16px'>{b}</span> <br/><div style='display:flex;justify-content: space-between;'><span>占比(%)</span><span class='dian_ti_blue_gradual_white' style='font-size:20px'>{d}%</span></div></div>`,
  textStyle: {
    fontSize: this.fontSize, // 字体大小
  },
  // trigger: "item",
  backgroundColor: "rgba(255, 255, 255, 0.2)", //设置背景图片 rgba格式
  // color: "black",
  // borderWidth: "1", //边框宽度设置1
  borderColor: "transparent", //设置边框颜色
  textStyle: {
    color: "#ffffff", //设置文字颜色
  },
};
// Vue.directive("load", {
//   bind: function (el, bind) {
//     el.style.position = "relative";
//     let div = document.createElement("div");
//     div.setAttribute("class", "loading_class");
//     div.style.position = "absolute";
//     div.style.width = "100%";
//     div.style.height = "100%";
//     div.style.backgroundColor = "#173d80"; // #173d80
//     div.style.display = "flex";
//     div.style.alignItems = "center";
//     div.style.justifyContent = "center";
//     div.innerHTML =
//       '<img src="../animate/loading.gif" style="width:100%;height:100%;" alt="">';
//     el.appendChild(div);
//     if (bind.value === true) {
//       div.style.display = "block";
//     }
//     if (bind.value === false) {
//       div.style.display = "none";
//     }
//   },
//   // update: function (el, bind) {
//   //   let arr = bind.value.split(" ");
//   //   let list = Array.prototype.slice.call(el.classList);
//   //   el.classList = arr.join(" ");
//   // },
//   componentUpdated: function (el, bind) {
//     let div = el.querySelector(".loading_class");
//     console.log(div, "ss");
//     if (bind.value === true) {
//       div.style.display = "block";
//     }
//     if (bind.value === false) {
//       div.style.display = "none";
//     }
//   },
// });
// console.log(Vue.prototype.getEchartsConfig("tooltip", { unit: "件" })); 2275px
Vue.component("centerNavigationZz", {
  template: `
  <div class="dhtiao" style="width: 2275px;" v-show="show">
  <a
   style="position: relative;"
   @click="open(item)"
   :href="hrefFn(item)" v-for="(item,index) in centerList" 
   :class="{xz:activeFn(item) || activePath(path,item.url)}"> 
   {{item.name}} 
   <template v-if='item.children'>
    <div v-show="item.flag" :class='"jiceng_zhili"+index' style="height: auto;white-space: nowrap;width: 290px;">
      <div   v-for="item1 in item.children" >
        <a  :title="item1.url" v-if="item1.show_children_judge ==='true'"  href="javascript:void(0)" @click="goWindow(item1.url)">{{item1.title}}</a>
        <a v-else  :href="VUE_APP_BIG_SCREEN+item1.url" :style="{color:path === VUE_APP_BIG_SCREEN + item1.url?'rgba(255, 255, 255, 1)':'rgba(255, 255, 255, 0.8)'}">{{item1.title}}</a>
      </div>
    </div> 
   </template>
   </a>
  </div>
  `,
  data() {
    return {
      flag: false,
      show: false,
      centerList: [
        {
          name: "社会治理要素",
          url: "/bigHtml/bigScreen/socialGovernance.html",
        },
        {
          name: "社区治理",
          url: "/bigHtml/bigScreen/communityGovernance.html",
        },
        // {
        //   name: "矛盾纠纷调节",
        //   url: "#",
        // },
        {
          name: "弱势群体帮扶",
          url: "/bigHtml/bigScreen/vulnerableGroups.html",
        },
        {
          name: "重点场所管控",
          url: "/bigHtml/bigScreen/emphasisPlace.html",
        },
        {
          name: "重点人员管控",
          url: "/bigHtml/bigScreen/emphasisPulation.html",
        },
        {
          name: "流动人口监管",
          url: "/bigHtml/bigScreen/intoPopulation.html",
        },
        {
          name: "基层治理力量融合下沉",
          url: "#",
        },
        {
          name: "公检法司分析",
          url: "/bigHtml/sifa/gongjiansifa.html",
        },
        {
          name: "矛盾纠纷调解",
          url: "#",
        },
      ],
      jiceng_zhili: [
        {
          name: "党建引领",
          url: "/bigHtml/cityManagement/dangjianyinling.html",
        },
        {
          name: "网格治理",
          url: "/bigHtml/cityManagement/wanggezhili.html",
        },
      ],
    };
  },
  computed: {
    path: function () {
      return location.pathname;
    },
    positionArr: function () {
      let arr = this.centerList.filter((res) => {
        if (res.children) {
          let judge = Array.isArray(res.children);
          let judge1 = res.children.length > 0 ? true : false;
          return judge && judge1;
        } else {
          return false;
        }
      });
      return arr.map((res) => res.name);
    },
  },
  mounted() {
    this.Request({
      url: "/baseInfo/tbBaseMenu/getScreenBycondition",
      params: {
        code: "3",
      },
      method: "get",
    }).then((res) => {
      this.centerList = res.data.map((res1) => {
        if (res.children) {
          res.flag = false;
        }
        res1.name = res1.title;
        return res1;
      });
      this.show = true;
    });
    // this.Request({
    //   url: "/baseInfo/tbBaseMenu/getScreenBycondition",
    //   params: {
    //     code: "10",
    //   },
    //   method: "get",
    // }).then((res) => {
    //   this.jiceng_zhili = res.data.map((res1) => {
    //     res1.name = res1.title;
    //     return res1;
    //   });
    // });
  },
  methods: {
    open: function (item) {
      // item.flag = !item.flag;
      console.log("ss", item);
      this.$set(item, "flag", !item.flag);
    },
    hrefFn: function (item) {
      if (item.children) {
        return "javascript:void(0);";
      } else {
        return this.VUE_APP_BIG_SCREEN + item.url;
      }
    },
    goWindow(url) {
      location.href = url;
    },
    activeFn: function (item) {
      // if (item.children && Array.isArray(item.children)) {
      //   let arr = item.children.map((res) => res.url);
      //   console.log(arr, "ggg", arr.includes(item.url), item.url);
      //   if (item.url === "#") {
      //     return false;
      //   }
      //   return arr.includes(item.url);
      // }
      return this.path === this.VUE_APP_BIG_SCREEN + item.url;
    },
    activePath(path, itemPath) {
      let self = this;
      let obj = null;
      let fn = function (arr, index2) {
        let len = arr.length;
        for (let index = 0; index < len; index++) {
          const item = arr[index];
          // console.log(item.url, "fff", path, item.url === path);
          if (self.VUE_APP_BIG_SCREEN + item.url === path) {
            judge = true;
            obj = item;
            obj.index = index2;
          }
          if (item.children) {
            fn(item.children, index2);
          } else {
          }
        }
      };
      this.centerList.find((res, index) => {
        fn([res], index);
      });
      // console.log(this.centerList[obj.index], "index");
      if (obj && obj.index) {
        if (this.centerList[obj.index]) {
          let item = this.centerList[obj.index];
          return item.url === itemPath;
        } else {
          return false;
        }
      } else {
        return false;
      }
    },
  },
});
Vue.component("centerNavigationCg", {
  template: `
  <div class="dhtiao dhtiao2" v-show="show"><a :href="VUE_APP_BIG_SCREEN + item.url" v-for="item in centerList" :class="{xz:path === VUE_APP_BIG_SCREEN + item.url}" > {{item.name}} </a>
  </div>`,
  data() {
    return {
      show: false,
      centerList: [
        {
          name: "城市概况",
          url: "/bigHtml/cityManagement/gaikuangzhuanti.html",
        },
        {
          name: "综合监管",
          url: "/bigHtml/cityManagement/zonghejianguan.html",
        },
        {
          name: "案事件分析",
          url: "/bigHtml/cityManagement/anjianfenxi.html",
        },
      ],
    };
  },
  computed: {
    path: function () {
      return location.pathname;
    },
  },
  mounted() {
    this.Request({
      url: "/baseInfo/tbBaseMenu/getScreenBycondition",
      params: {
        code: "11",
      },
      method: "get",
    }).then((res) => {
      this.centerList = res.data.map((res1) => {
        res1.name = res1.title;
        return res1;
      });
      this.show = true;
    });
  },
});
Vue.component("centerNavigationYj", {
  // template: `
  // <div class="dhtiao dhtiao1">
  //     <a href="#">综合态势</a>
  //     <a href="#">电梯专题</a>
  //     <a href="#" class="xz">疫情防控</a>
  //  </div>`,
  template: `
  <div class="dhtiao dhtiao1" v-show="show" style="position: relative;bottom: 1px;;width:400px"><a :href="VUE_APP_BIG_SCREEN + item.url" v-for="item in centerList" :class="{xz:path ===VUE_APP_BIG_SCREEN +  item.url}" > {{item.name}} </a>
  </div>`,
  data() {
    return {
      show: false,
      centerList: [
        {
          name: "综合态势",
          url: "/bigHtml/zonghe/zonghetaishi.html",
        },
        {
          name: "电梯专题",
          url: "/bigHtml/yingji/dianti.html",
        },
        {
          name: "疫情防控",
          url: "/bigHtml/yingji/yiqing.html",
        },
      ],
    };
  },
  computed: {
    path: function () {
      return location.pathname;
    },
  },
  mounted() {
    this.Request({
      url: "/baseInfo/tbBaseMenu/getScreenBycondition",
      params: {
        code: "15",
      },
      method: "get",
    }).then((res) => {
      this.centerList = res.data.map((res1) => {
        res1.name = res1.title;
        return res1;
      });
      this.show = true;
    });
  },
});
/**echarts跳动 dataLength 数据长度必传 */
Vue.prototype.tooltipSwiper = function (dataLength = 3, duration = 4000) {
  if (dataLength <= 1) return;
  let myChart = this;
  let count = 0;
  let timeTicket = null;
  timeTicket && clearInterval(timeTicket);
  timeTicket = setInterval(function () {
    // 判断如果等于数据的长度那么 dataLength = 0
    if (count === dataLength) {
      count = 0;
    }
    myChart.dispatchAction({
      type: "downplay",
      seriesIndex: 0,
    });
    myChart.dispatchAction({
      type: "highlight",
      seriesIndex: 0,
      dataIndex: count,
    });
    myChart.dispatchAction({
      type: "showTip",
      seriesIndex: 0,
      dataIndex: count,
    });
    count++;
  }, duration);
};
Vue.prototype.useList = function (result, option1) {
  let echarts = [];
  let list = [];
  let barEcharts = {
    x: [],
    y: [],
  };
  let doubleBarEcharts = {
    x: [],
    y1: [],
    y2: [],
  };
  let doubleBarEcharts2 = {
    x: [],
    y1: [],
    y2: [],
  };
  let option = Object.assign(
    {
      fixed: 2,
      value: "statics",
      name: "item",
      bar: false, // 单折线
      doubleBar: false, // 双折线
      doubleBar2: false, // 双柱状
      doubleBarObj: {
        x: "staticsMonth", // 双折线x轴名称
        y1: "closedNumber", // 双折线y1轴名称
        y2: "reportedNumber", // 双折线y2轴名称
      },
      doubleBarObj2: {
        x: "staticsMonth", // 柱状图x轴名称
        y1: "closedNumber", // 柱状图y1轴名称
        y2: "reportedNumber", // 柱状图y2轴名称
      },
      color: [
        "#ffeb78",
        "#6ff7b5",
        "#3c8cf6",
        "#F09228 ",
        "#135AEF",
        "#11A8AB",
        "#4FC4F6",
        "#FFA06E",
        "#f7f13f",
      ],
      center: "center",
    },
    option1
  );
  if (option.bar && option.doubleBar && doubleBar2) {
    console.error("支持图表类型默认饼图 仅额外开启一种");
    return {
      echarts: [],
      list: [],
    };
  }
  if (option.doubleBar) {
    let { x, y1, y2 } = option.doubleBarObj;
    if (result.length > 0) {
      result.map((res, index) => {
        doubleBarEcharts.x[index] = res[x];
        doubleBarEcharts.y1[index] = res[y1];
        doubleBarEcharts.y2[index] = res[y2];
      });
    }
    return {
      doubleBarEcharts,
    };
  }

  if (option.doubleBar2) {
    let { x, y1, y2 } = option.doubleBarObj2;
    if (result.length > 0) {
      result.map((res, index) => {
        doubleBarEcharts2.x[index] = res[x];
        doubleBarEcharts2.y1[index] = res[y1];
        doubleBarEcharts2.y2[index] = res[y2];
      });
    }
    return {
      doubleBarEcharts2,
    };
  }
  let colors = option.color;
  if (result.length > 0) {
    let total = 0;
    result.map((res, index) => {
      total = total + res[option.value];
      let obj = {
        value: res[option.value],
        name: res[option.name],
      };
      echarts[index] = obj;
      list[index] = {
        text: obj.name,
        number: obj.value,
        slots: "a" + index,
        unit: "人",
        color: colors[index],
      };
      if (obj[option.center]) {
        list[index][option.center] = obj[option.center];
      }
    });
    list.map((res, index) => {
      list[index].progress = (res.number / total).toFixed(option.fixed) * 100;
    });
    if (option.bar) {
      echarts.map((res, index) => {
        barEcharts.x[index] = res.name;
        barEcharts.y[index] = res.value;
      });
    }
  }
  let result1 = {
    echarts,
    list,
  };
  if (option.bar) {
    result1.barEcharts = barEcharts; // 柱状图处理
  }
  return result1;
};
Vue.prototype.colors = [
  new echarts.graphic.LinearGradient(0, 0, 1, 0, [
    { offset: 0, color: "#3CF0E1" },
    { offset: 1, color: "#A0FF8C" },
  ]),
  new echarts.graphic.LinearGradient(0, 0, 1, 0, [
    { offset: 0, color: "#3CA5F0" },
    { offset: 1, color: "#3CF0E1" },
  ]),
  new echarts.graphic.LinearGradient(0, 0, 1, 0, [
    { offset: 0, color: "#3C7DFA" },
    { offset: 1, color: "#3CA5F0" },
  ]),
  new echarts.graphic.LinearGradient(0, 0, 1, 0, [
    { offset: 0, color: "#FF7373" },
    { offset: 1, color: "#FFA06E" },
  ]),
  new echarts.graphic.LinearGradient(0, 0, 1, 0, [
    { offset: 0, color: "#FFA06E" },
    { offset: 1, color: "#FFC878" },
  ]),
  new echarts.graphic.LinearGradient(0, 0, 1, 0, [
    { offset: 0, color: "#D23CF0" },
    { offset: 1, color: "#A000F0" },
  ]),
  new echarts.graphic.LinearGradient(0, 0, 1, 0, [
    { offset: 0, color: "#3CD2F0" },
    { offset: 1, color: "#3C7DFA" },
  ]),
  new echarts.graphic.LinearGradient(0, 0, 1, 0, [
    { offset: 0, color: "#FFC673" },
    { offset: 1, color: "#FFF500" },
  ]),
  new echarts.graphic.LinearGradient(0, 0, 1, 0, [
    { offset: 0, color: "#FFC673" },
    { offset: 1, color: "#FFF670" },
  ]),
];
Vue.prototype.bgColors = [
  "linear-gradient(290deg, #3CF0E1 50%, #A0FF8C 89%)",
  "linear-gradient(290deg, #3CA5F0 50%, #3CF0E1 89%)",
  "linear-gradient(290deg, #3C7DFA 50%, #3CA5F0 89%)",
  "linear-gradient(290deg, #FF7373 50%, #FFA06E 89%)",
  "linear-gradient(290deg, #FFA06E 50%, #FFC878 89%)",
  "linear-gradient(290deg, #D23CF0 50%, #A000F0 89%)",
  "linear-gradient(290deg, #3CD2F0 50%, #3C7DFA 89%)",
  "linear-gradient(290deg, #FFC673 50%, #FFF500 89%)",
  "linear-gradient(290deg, #FFC673 50%, #FFF670 89%)",
];

Vue.prototype.threePieColors = {
  colors: [
    new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      { offset: 0, color: "#3CF0E1" },
      { offset: 1, color: "#A0FF8C" },
    ]),
    new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      { offset: 0, color: "#3C7DFA" },
      { offset: 1, color: "#3CA5F0" },
    ]),
    new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      { offset: 0, color: "#FFC878" },
      { offset: 1, color: "#FFFA78" },
    ]),
    new echarts.graphic.LinearGradient(0, 0, 1, 0, [
      { offset: 0, color: "#3CA5F0" },
      { offset: 1, color: "#3CF0E1" },
    ]),
    new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      { offset: 0, color: "#FFA06E" },
      { offset: 1, color: "#FFC878" },
    ]),
    new echarts.graphic.LinearGradient(0, 0, 1, 0, [
      { offset: 0, color: "#FF7373" },
      { offset: 1, color: "#FFA06E" },
    ]),
    new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      { offset: 0, color: "#D23CF0" },
      { offset: 1, color: "#A000F0" },
    ]),
    new echarts.graphic.LinearGradient(0, 0, 1, 0, [
      { offset: 0, color: "#FFA06E" },
      { offset: 1, color: "#FFA06E" },
    ]),
    new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      { offset: 0, color: "#D23CF0" },
      { offset: 1, color: "#A000F0" },
    ]),
  ],
  bgColors: [
    "linear-gradient(290deg, #3CF0E1 50%, #A0FF8C 89%)",
    "linear-gradient(290deg, #3C7DFA 50%, #3CA5F0 89%)",
    "linear-gradient(290deg, #FFC878 50%, #FFFA78 89%)",
    "linear-gradient(290deg, #3CA5F0 50%, #3CF0E1 89%)",
    "linear-gradient(290deg, #FFA06E 50%, #FFC878 89%)",
    "linear-gradient(290deg, #FF7373 50%, #FFA06E 89%)",
    "linear-gradient(290deg, #D23CF0 50%, #A000F0 89%)",
    "linear-gradient(290deg, #FF7373 50%, #FF7373 89%)",
    "linear-gradient(290deg, #A000F0 50%, #A000F0 89%)",
  ],
};
Vue.prototype.fourPieColors = {
  colors: [
    new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      { offset: 0, color: "#3CF0E1" },
      { offset: 1, color: "#A0FF8C" },
    ]),
    new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      { offset: 0, color: "#3C7DFA" },
      { offset: 1, color: "#3CA5F0" },
    ]),
    new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      { offset: 0, color: "#FFA06E" },
      { offset: 1, color: "#FFC878" },
    ]),

    new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      { offset: 0, color: "#FFC878" },
      { offset: 1, color: "#FFFA78" },
    ]),
    new echarts.graphic.LinearGradient(0, 0, 1, 0, [
      { offset: 0, color: "#3CA5F0" },
      { offset: 1, color: "#3CF0E1" },
    ]),
    new echarts.graphic.LinearGradient(0, 0, 1, 0, [
      { offset: 0, color: "#FF7373" },
      { offset: 1, color: "#FFA06E" },
    ]),
    new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      { offset: 0, color: "#7FFF00" },
      { offset: 1, color: "#7FFF00" },
    ]),
    new echarts.graphic.LinearGradient(0, 0, 1, 0, [
      { offset: 0, color: "#3CF0E1" },
      { offset: 1, color: "#3CF0E1" },
    ]),
    new echarts.graphic.LinearGradient(0, 0, 0, 1, [
      { offset: 0, color: "#87CEFA" },
      { offset: 1, color: "#87CEFA" },
    ]),
  ],
  bgColors: [
    "linear-gradient(290deg, #3CF0E1 50%, #A0FF8C 89%)",
    "linear-gradient(290deg, #3C7DFA 50%, #3CA5F0 89%)",
    "linear-gradient(290deg, #FFA06E 50%, #FFC878 89%)",
    "linear-gradient(290deg, #FFC878 50%, #FFFA78 89%)",
    "linear-gradient(290deg, #3CA5F0 50%, #3CF0E1 89%)",
    "linear-gradient(290deg, #FF7373 50%, #FFA06E 89%)",
    "linear-gradient(290deg, #7FFF00 50%, #7FFF00 89%)",
    "linear-gradient(290deg, #3CF0E1 50%, #3CF0E1 89%)",
    "linear-gradient(290deg, #87CEFA 50%, #87CEFA 89%)",
  ],
};

/**数字跳动 CountTo */
!(function (t, e) {
  "object" == typeof exports && "object" == typeof module
    ? (module.exports = e())
    : "function" == typeof define && define.amd
    ? define("CountTo", [], e)
    : "object" == typeof exports
    ? (exports.CountTo = e())
    : (t.CountTo = e());
})(this, function () {
  return (function (t) {
    function e(n) {
      if (i[n]) return i[n].exports;
      var a = (i[n] = { i: n, l: !1, exports: {} });
      return t[n].call(a.exports, a, a.exports, e), (a.l = !0), a.exports;
    }
    var i = {};
    return (
      (e.m = t),
      (e.c = i),
      (e.i = function (t) {
        return t;
      }),
      (e.d = function (t, i, n) {
        e.o(t, i) ||
          Object.defineProperty(t, i, {
            configurable: !1,
            enumerable: !0,
            get: n,
          });
      }),
      (e.n = function (t) {
        var i =
          t && t.__esModule
            ? function () {
                return t.default;
              }
            : function () {
                return t;
              };
        return e.d(i, "a", i), i;
      }),
      (e.o = function (t, e) {
        return Object.prototype.hasOwnProperty.call(t, e);
      }),
      (e.p = "/dist/"),
      e((e.s = 2))
    );
  })([
    function (t, e, i) {
      var n = i(4)(i(1), i(5), null, null);
      t.exports = n.exports;
    },
    function (t, e, i) {
      "use strict";
      Object.defineProperty(e, "__esModule", { value: !0 });
      var n = i(3);
      e.default = {
        props: {
          startVal: { type: Number, required: !1, default: 0 },
          endVal: { type: Number, required: !1, default: 2017 },
          duration: { type: Number, required: !1, default: 3e3 },
          autoplay: { type: Boolean, required: !1, default: !0 },
          decimals: {
            type: Number,
            required: !1,
            default: 0,
            validator: function (t) {
              return t >= 0;
            },
          },
          decimal: { type: String, required: !1, default: "." },
          separator: { type: String, required: !1, default: "," },
          prefix: { type: String, required: !1, default: "" },
          suffix: { type: String, required: !1, default: "" },
          useEasing: { type: Boolean, required: !1, default: !0 },
          easingFn: {
            type: Function,
            default: function (t, e, i, n) {
              return (i * (1 - Math.pow(2, (-10 * t) / n)) * 1024) / 1023 + e;
            },
          },
          renderDom: {
            type: String,
            default: "span",
          },
        },
        data: function () {
          return {
            localStartVal: this.startVal,
            displayValue: this.formatNumber(this.startVal),
            printVal: null,
            paused: !1,
            localDuration: this.duration,
            startTime: null,
            timestamp: null,
            remaining: null,
            rAF: null,
          };
        },
        computed: {
          countDown: function () {
            return this.startVal > this.endVal;
          },
        },
        watch: {
          startVal: function () {
            this.autoplay && this.start();
          },
          endVal: function () {
            this.autoplay && this.start();
          },
        },
        mounted: function () {
          this.autoplay && this.start(), this.$emit("mountedCallback");
        },
        methods: {
          start: function () {
            (this.localStartVal = this.startVal),
              (this.startTime = null),
              (this.localDuration = this.duration),
              (this.paused = !1),
              (this.rAF = (0, n.requestAnimationFrame)(this.count));
          },
          pauseResume: function () {
            this.paused
              ? (this.resume(), (this.paused = !1))
              : (this.pause(), (this.paused = !0));
          },
          pause: function () {
            (0, n.cancelAnimationFrame)(this.rAF);
          },
          resume: function () {
            (this.startTime = null),
              (this.localDuration = +this.remaining),
              (this.localStartVal = +this.printVal),
              (0, n.requestAnimationFrame)(this.count);
          },
          reset: function () {
            (this.startTime = null),
              (0, n.cancelAnimationFrame)(this.rAF),
              (this.displayValue = this.formatNumber(this.startVal));
          },
          count: function (t) {
            this.startTime || (this.startTime = t), (this.timestamp = t);
            var e = t - this.startTime;
            (this.remaining = this.localDuration - e),
              this.useEasing
                ? this.countDown
                  ? (this.printVal =
                      this.localStartVal -
                      this.easingFn(
                        e,
                        0,
                        this.localStartVal - this.endVal,
                        this.localDuration
                      ))
                  : (this.printVal = this.easingFn(
                      e,
                      this.localStartVal,
                      this.endVal - this.localStartVal,
                      this.localDuration
                    ))
                : this.countDown
                ? (this.printVal =
                    this.localStartVal -
                    (this.localStartVal - this.endVal) *
                      (e / this.localDuration))
                : (this.printVal =
                    this.localStartVal +
                    (this.localStartVal - this.startVal) *
                      (e / this.localDuration)),
              this.countDown
                ? (this.printVal =
                    this.printVal < this.endVal ? this.endVal : this.printVal)
                : (this.printVal =
                    this.printVal > this.endVal ? this.endVal : this.printVal),
              (this.displayValue = this.formatNumber(this.printVal)),
              e < this.localDuration
                ? (this.rAF = (0, n.requestAnimationFrame)(this.count))
                : this.$emit("callback");
          },
          isNumber: function (t) {
            return !isNaN(parseFloat(t));
          },
          formatNumber: function (t) {
            if (typeof t === "number" && !Number.isNaN(t)) {
              (t = t.toFixed(this.decimals)), (t += "");
              var e = t.split("."),
                i = e[0],
                n = e.length > 1 ? this.decimal + e[1] : "",
                a = /(\d+)(\d{3})/;
              if (this.separator && !this.isNumber(this.separator))
                for (; a.test(i); )
                  i = i.replace(a, "$1" + this.separator + "$2");
              return this.prefix + i + n + this.suffix;
            } else {
              var e = t.split("."),
                i = e[0],
                n = e.length > 1 ? this.decimal + e[1] : "",
                a = /(\d+)(\d{3})/;
              if (this.separator && !this.isNumber(this.separator))
                for (; a.test(i); )
                  i = i.replace(a, "$1" + this.separator + "$2");
              return this.prefix + i + n + this.suffix;
            }
          },
        },
        destroyed: function () {
          (0, n.cancelAnimationFrame)(this.rAF);
        },
      };
    },
    function (t, e, i) {
      "use strict";
      Object.defineProperty(e, "__esModule", { value: !0 });
      var n = i(0),
        a = (function (t) {
          return t && t.__esModule ? t : { default: t };
        })(n);
      (e.default = a.default),
        "undefined" != typeof window &&
          window.Vue &&
          window.Vue.component("count-to", a.default);
    },
    function (t, e, i) {
      "use strict";
      Object.defineProperty(e, "__esModule", { value: !0 });
      var n = 0,
        a = "webkit moz ms o".split(" "),
        r = void 0,
        o = void 0;
      if ("undefined" == typeof window)
        (e.requestAnimationFrame = r = function () {}),
          (e.cancelAnimationFrame = o = function () {});
      else {
        (e.requestAnimationFrame = r = window.requestAnimationFrame),
          (e.cancelAnimationFrame = o = window.cancelAnimationFrame);
        for (var s = void 0, u = 0; u < a.length && (!r || !o); u++)
          (s = a[u]),
            (e.requestAnimationFrame = r =
              r || window[s + "RequestAnimationFrame"]),
            (e.cancelAnimationFrame = o =
              o ||
              window[s + "CancelAnimationFrame"] ||
              window[s + "CancelRequestAnimationFrame"]);
        (r && o) ||
          ((e.requestAnimationFrame = r =
            function (t) {
              var e = new Date().getTime(),
                i = Math.max(0, 16 - (e - n)),
                a = window.setTimeout(function () {
                  t(e + i);
                }, i);
              return (n = e + i), a;
            }),
          (e.cancelAnimationFrame = o =
            function (t) {
              window.clearTimeout(t);
            }));
      }
      (e.requestAnimationFrame = r), (e.cancelAnimationFrame = o);
    },
    function (t, e) {
      t.exports = function (t, e, i, n) {
        var a,
          r = (t = t || {}),
          o = typeof t.default;
        ("object" !== o && "function" !== o) || ((a = t), (r = t.default));
        var s = "function" == typeof r ? r.options : r;
        if (
          (e &&
            ((s.render = e.render), (s.staticRenderFns = e.staticRenderFns)),
          i && (s._scopeId = i),
          n)
        ) {
          var u = Object.create(s.computed || null);
          Object.keys(n).forEach(function (t) {
            var e = n[t];
            u[t] = function () {
              return e;
            };
          }),
            (s.computed = u);
        }
        return { esModule: a, exports: r, options: s };
      };
    },
    function (t, e) {
      t.exports = {
        render: function () {
          var t = this,
            e = t.$createElement;
          return (t._self._c || e)(t.renderDom, [
            t._v("\n  " + t._s(t.displayValue) + "\n"),
          ]);
        },
        staticRenderFns: [],
      };
    },
  ]);
});

Vue.component("countTo", CountTo.default);
//# sourceMappingURL=vue-count-to.min.js.map

// 排序超出滚动组件
function observerDomResize(dom, callback) {
  const MutationObserver =
    window.MutationObserver ||
    window.WebKitMutationObserver ||
    window.MozMutationObserver;

  const observer = new MutationObserver(callback);

  observer.observe(dom, {
    attributes: true,
    attributeFilter: ["style"],
    attributeOldValue: true,
  });

  return observer;
}
function debounce(delay, callback) {
  let lastTime;

  return function () {
    clearTimeout(lastTime);

    const [that, args] = [this, arguments];

    lastTime = setTimeout(() => {
      callback.apply(that, args);
    }, delay);
  };
}
let min = {
  data() {
    return {
      dom: "",

      width: 0,
      height: 0,

      debounceInitWHFun: "",

      domObserver: "",
    };
  },
  methods: {
    async autoResizeMixinInit() {
      const {
        initWH,
        getDebounceInitWHFun,
        bindDomResizeCallback,
        afterAutoResizeMixinInit,
      } = this;
      await initWH(false);
      getDebounceInitWHFun();
      bindDomResizeCallback();
      if (typeof afterAutoResizeMixinInit === "function")
        afterAutoResizeMixinInit();
    },
    initWH(resize = true) {
      const { $nextTick, $refs, ref, onResize } = this;

      return new Promise((resolve) => {
        $nextTick((_) => {
          const dom = (this.dom = $refs[ref]);

          this.width = dom ? dom.clientWidth : 0;
          this.height = dom ? dom.clientHeight : 0;

          if (!dom) {
            console.warn(
              "DataV: Failed to get dom node, component rendering may be abnormal!"
            );
          } else if (!this.width || !this.height) {
            console.warn(
              "DataV: Component width or height is 0px, rendering abnormality may occur!"
            );
          }

          if (typeof onResize === "function" && resize) onResize();

          resolve();
        });
      });
    },
    getDebounceInitWHFun() {
      const { initWH } = this;
      this.debounceInitWHFun = debounce(100, initWH);
    },
    bindDomResizeCallback() {
      const { dom, debounceInitWHFun } = this;
      this.domObserver = observerDomResize(dom, debounceInitWHFun);

      window.addEventListener("resize", debounceInitWHFun);
    },
    unbindDomResizeCallback() {
      let { domObserver, debounceInitWHFun } = this;

      if (!domObserver) return;

      domObserver.disconnect();
      domObserver.takeRecords();
      domObserver = null;

      window.removeEventListener("resize", debounceInitWHFun);
    },
  },
  mounted() {
    const { autoResizeMixinInit } = this;

    autoResizeMixinInit();
  },
  beforeDestroy() {
    const { unbindDomResizeCallback } = this;

    unbindDomResizeCallback();
  },
};
let scroll = {
  name: "scroll",
  mixins: [min],
  template: `<div class="dv-scroll-ranking-board" :ref="ref" @mouseenter="enter" @mouseleave="leave">
    <div
      class="row-item"
      v-for="(item, i) in rows"
      :key="item.toString() + item.scroll"
      :style="{height: heights[i]+'px'}"
    >
      <slot :data="item">
        <div class="ranking-info">
          <div class="rank">No.{{ item.ranking }}</div>
          <div class="info-name" v-html="item.name" />
          <div class="ranking-value">{{ item.value }}</div>
        </div>

        <div class="ranking-column">
          <div
            class="inside-column"
            :style="{width:item.percent+'%'}"
          >
            <div class="shine" />
          </div>
        </div>  
      </slot>
    </div>
  </div>`,
  props: {
    config: {
      type: Object,
      default: () => ({}),
    },
    className: "dv-scroll-ranking-board",
  },
  data() {
    return {
      ref: "scroll-ranking-board",

      defaultConfig: {
        /**
         * @description Board data
         * @type {Array<Object>}
         * @default data = []
         */
        data: [
          {
            name: "周口",
            value: 55,
          },
          {
            name: "南阳",
            value: 120,
          },
          {
            name: "西峡",
            value: 78,
          },
          {
            name: "驻马店",
            value: 66,
          },
          {
            name: "新乡",
            value: 80,
          },
          {
            name: "信阳",
            value: 45,
          },
          {
            name: "漯河1",
            value: 29,
          },
          {
            name: "新乡2",
            value: 80,
          },
          {
            name: "信阳3",
            value: 45,
          },
          {
            name: "漯河4",
            value: 29,
          },
        ],
        /**
         * @description Row num
         * @type {Number}
         * @default rowNum = 5
         */
        rowNum: 5,
        /**
         * @description Scroll wait time
         * @type {Number}
         * @default waitTime = 2000
         */
        waitTime: 2000,
        /**
         * @description Carousel type
         * @type {String}
         * @default carousel = 'single'
         * @example carousel = 'single' | 'page'
         */
        carousel: "single",
        /**
         * @description Value unit
         * @type {String}
         * @default unit = ''
         * @example unit = 'ton'
         */
        unit: "",
        /**
         * @description Auto sort by value
         * @type {Boolean}
         * @default sort = true
         */
        sort: true,
        /**
         * @description Value formatter
         * @type {Function}
         * @default valueFormatter = null
         */
        valueFormatter: null,
      },

      mergedConfig: null,

      rowsData: [],

      rows: [],

      heights: [],

      animationIndex: 0,

      animationHandler: "",

      updater: 0,
      dom: "",

      width: 0,
      height: 0,

      debounceInitWHFun: "",

      domObserver: "",
    };
  },
  watch: {
    config() {
      const { stopAnimation, calcData } = this;

      stopAnimation();

      calcData();
    },
  },
  methods: {
    afterAutoResizeMixinInit() {
      const { calcData } = this;
      calcData();
    },
    enter() {
      const { stopAnimation } = this;

      stopAnimation();
    },
    leave() {
      const { animation } = this;

      animation(true);
    },
    onResize() {
      const { mergedConfig, calcHeights } = this;

      if (!mergedConfig) return;

      calcHeights(true);
    },
    calcData() {
      const { mergeConfig, calcRowsData } = this;

      mergeConfig();

      calcRowsData();

      const { calcHeights } = this;

      calcHeights();

      const { animation } = this;

      animation(true);
    },
    mergeConfig() {
      this.mergedConfig = Object.assign(this.defaultConfig, this.config);
    },
    calcRowsData() {
      let { data, rowNum, sort } = this.mergedConfig;

      sort &&
        data.sort(({ value: a }, { value: b }) => {
          if (a > b) return -1;
          if (a < b) return 1;
          if (a === b) return 0;
        });

      const value = data.map(({ value }) => value);

      const min = Math.min(...value) || 0;

      // abs of min
      const minAbs = Math.abs(min);

      const max = Math.max(...value) || 0;

      // abs of max
      const maxAbs = Math.abs(max);

      const total = max + minAbs;

      data = data.map((row, i) => ({
        ...row,
        ranking: i + 1,
        percent: ((row.value + minAbs) / total) * 100,
      }));
      const rowLength = data.length;

      if (rowLength > rowNum && rowLength < 2 * rowNum) {
        data = [...data, ...data];
      }

      data = data.map((d, i) => ({ ...d, scroll: i }));

      this.rowsData = data;
      this.rows = data;
    },
    calcHeights(onresize = false) {
      const { height, mergedConfig } = this;

      const { rowNum, data } = mergedConfig;

      const avgHeight = height / rowNum;

      this.avgHeight = avgHeight;

      if (!onresize) this.heights = new Array(data.length).fill(60);
    },
    async animation(start = false) {
      let {
        avgHeight,
        animationIndex,
        mergedConfig,
        rowsData,
        animation,
        updater,
      } = this;

      const { waitTime, carousel, rowNum } = mergedConfig;

      const rowLength = rowsData.length;

      if (rowNum >= rowLength) return;

      if (start) {
        await new Promise((resolve) => setTimeout(resolve, waitTime));
        if (updater !== this.updater) return;
      }

      const animationNum = carousel === "single" ? 1 : rowNum;

      let rows = rowsData.slice(animationIndex);
      rows.push(...rowsData.slice(0, animationIndex));

      this.rows = rows.slice(0, rowNum + 1);
      this.heights = new Array(rowLength).fill(avgHeight);

      await new Promise((resolve) => setTimeout(resolve, 300));
      if (updater !== this.updater) return;

      this.heights.splice(0, animationNum, ...new Array(animationNum).fill(0));

      animationIndex += animationNum;

      const back = animationIndex - rowLength;
      if (back >= 0) animationIndex = back;

      this.animationIndex = animationIndex;
      this.animationHandler = setTimeout(animation, waitTime - 300);
    },
    stopAnimation() {
      const { animationHandler, updater } = this;

      this.updater = (updater + 1) % 999999;

      if (!animationHandler) return;

      clearTimeout(animationHandler);
    },
  },
  destroyed() {
    const { stopAnimation } = this;

    stopAnimation();
  },
};
Vue.component("scroll", scroll);
window.extraAjax = function (method, data, config) {
  let arr = ["get", "post"];
  let initConfig = {
    header: {},
    success: function (res) {},
    error: function (err) {},
    url: `/common/getCimMapPoint`,
  };
  if (config) {
    Object.assign(initConfig, config);
  }
  if (arr.includes(method)) {
    if (method === "get") {
      return new Promise((resolve, reject) => {
        $.ajax({
          url: proxy_api + initConfig.url,
          method: "get",
          header: initConfig.header,
          // contentType: "application/json;charset=UTF-8",
          data: data,
          success: (res) => {
            resolve(res);
            if (typeof initConfig.success === "function") {
              initConfig.success(res);
            }
          },
          error: (err) => {
            reject(err);
            if (typeof initConfig.error === "function") {
              initConfig.error(err);
            }
          },
        });
      });
    }
    if (method === "post") {
      return new Promise((resolve, reject) => {
        $.ajax({
          url: proxy_api + initConfig.url,
          method: method,
          header: initConfig.header,
          contentType: "application/json;charset=UTF-8",
          data: JSON.stringify(data),
          success: (res) => {
            resolve(res);
            if (typeof initConfig.success === "function") {
              initConfig.success(res);
            }
          },
          error: (err) => {
            reject(err);
            if (typeof initConfig.error === "function") {
              initConfig.error(err);
            }
          },
        });
      });
    }
  } else {
    console.error(`不支持此方法调用,请传入${arr.toString()}`);
  }
};
